/* eslint-disable no-undef */
/*
 * @Author: Lwp
 * @Date: 2021-05-08 19:22:24
 * @LastEditors: lwp
 * @LastEditTime: 2022-01-15 18:01:22
 * @Description: file content
 */
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
// A modern alternative to CSS resets
import 'normalize.css/normalize.css'
// element-ui
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import 'el-bigdata-table'
import '@/styles/global.scss'
// 延迟加载组件
import LazyRender from 'vue-lazy-render'
/** 事件传递 */
import VueBus from 'vue-bus'
import '@/permission'
import '@/icons'
import messageBox from '@/utils/messageBox'
// import echarts from 'echarts'
// 注册所有的过滤器方法
// filters.forEach((item) => {
//   for (let [key, fuc] of Object.entries(item)) {
//     console.log('item', item, key, fuc)
//     Vue.filter()
//   }
// })

import * as filters from './filters'
Vue.use(LazyRender)
// 注册全局过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
// require('./mock')
// Vue.prototype.$echarts = echarts
Vue.prototype.$msgBox = messageBox
Vue.use(ElementUI)
Vue.use(VueBus)
// 处理时间的过滤器
Vue.config.productionTip = false
Vue.prototype.$keyBoard = function (vm, methodName, code, params) {
  document.onkeydown = function () {
    let key = window.event.keyCode
    if (key === code) {
      vm[methodName](params) // 触发methodName事件
    }
  }
}
window.app = new Vue({
  el: '#app',
  router,
  store,
  data: {
    eventHub: new Vue()
  },
  render: h => h(App)
})
